package bootstrap

import (
	"Pandaria/filters"
	"github.com/astaxie/beego/logs"
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/orm"
	_ "github.com/go-sql-driver/mysql" // import your used driver
)

func Handle(){

	logs.SetLogger(logs.AdapterFile,`{"filename":"project.log","level":7,"maxlines":0,"maxsize":0,"daily":true,"maxdays":10}`)

	//过滤
	filters.AccessControlAllow()
	filters.FilterToken()
	url := beego.AppConfig.String("MYSQL_USER")+ ":" +
		beego.AppConfig.String("MYSQL_PASS") +"@tcp(" +
		beego.AppConfig.String("MYSQL_URL") + ")/" +
		beego.AppConfig.String("MYSQL_DB") + "?charset=utf8"
	logs.Debug(url)
	err := orm.RegisterDataBase("default", "mysql", url, 30)
	if err != nil{
		logs.Error(err)
	}
}
